﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/admin.Master" CodeBehind="SiteIDs.aspx.cs"
    Inherits="LiveWebServiceAdmin.SiteIDs" %>

<asp:Content ContentPlaceHolderID="MenuContent" ID="PageType" runat="server">
    <p>
        2</p>
</asp:Content>
<asp:Content ContentPlaceHolderID="TopContent" ID="PageInfo" runat="server">
    Site IDs
    <br />
    <br />
    Your Sites:
</asp:Content>
<asp:Content ContentPlaceHolderID="TopBannerContent" ID="PageAbout" runat="server">
    Edit Organization
</asp:Content>
<asp:Content ContentPlaceHolderID="BottomBannerContent" ID="Content1" runat="server">
    Add SiteIDs that has been sent to you Ed-Desk.
    <br />
    <br />
    SiteID is issued for a group of domains (main and accepted) to authenticate against
    SSO.
    <br />
    <br />
    Warning: Deleting the Site will cause all domain admins accounts and domains to
    be deleted.
</asp:Content>
<asp:Content ContentPlaceHolderID="BottomContent" ID="PageMain" runat="server">
    <div id="manageduser">
        <asp:HiddenField ID="hdManagedUser" runat="server" />
    </div>
    <div id="currentorganization">
        <asp:HiddenField ID="hdOrganization" runat="server" />
    </div>
    <table id="usertable" width="100%">
        <tr align="center">
            <td colspan="4">
                <asp:ListBox ID="lbUserSiteIDs" runat="server" Height="250px" Width="100%" SelectionMode="Single">
                </asp:ListBox>
                <asp:Label ID="lbError" runat="server" Text="" Visible="false"></asp:Label>
            </td>
        </tr>
        <tr align="center">
            <td>
                <a id="newsite" href="javascript:void(0)" title="Create new Site" class="thickbox">Add
                    Site</a>
            </td>
            <td>
                <div id="viewsite">
                    <a href="javascript:void(0)" title="View SiteIDs accounts">View Accounts</a>
                </div>
            </td>
            <td>
                <div id="editsite">
                    <a href="javascript:void(0)" title="Edit Site" class="thickbox">Edit Site</a>
                </div>
            </td>
            <td>
                <div id="deletesite">
                    <%--<a href="javascript:void(0)" title="Delete Site" class="thickbox">Delete Site</a>--%>
                    <asp:Button ID="btnDeleteOrg" CssClass="buttonlink" runat="server" Text="Delete Site"
                        OnClick="btnDeleteOrg_Click" />
                </div>
            </td>
        </tr>
    </table>
    <div>

        <script language="javascript" type="text/javascript">
            $(document).ready(function() {
                var manageuser = $("#manageduser").find("input").get(0).value;
                var manageorg = $("#currentorganization").find("input").get(0).value;
                $("#newsite").attr("href", "/ActionPages/managesite.aspx?manageuser=" + manageuser + "&manageorganization=" + manageorg + "&keepThis=true&TB_iframe=true&height=120&width=360");

                $("#viewsite").hide();
                $("#viewsite").find("a").attr("href", "javascript:void(0)");

                $("#editsite").hide();
                $("#editsite").find("a").attr("href", "javascript:void(0)");

                $("#deletesite").hide();
                $("#deletesite").find("a").attr("href", "javascript:void(0)");
            });

            $("#usertable").find("select").click(function(event) {
                var options = $("#usertable").find("option").each(function(index) {
                    if ($(this).attr("selected")) {
                        var manageuser = $("#manageduser").find("input").get(0).value;
                        var manageorg = $("#currentorganization").find("input").get(0).value;
                        var site = $(this).text();

                        $("#viewsite").show();
                        $("#viewsite").find("a").attr("href", "/accounts.aspx?manageuser=" + manageuser + "&manageorganization=" + manageorg + "&managesite=" + site);

                        $("#editsite").show();
                        $("#editsite").find("a").attr("href", "/ActionPages/managesite.aspx?manageuser=" + manageuser + "&manageorganization=" + manageorg + "&editsite=" + site + "&keepThis=true&TB_iframe=true&height=120&width=360");

                        $("#deletesite").show();
                        //                        $("#deletesite").find("a").attr("href", "/ActionPages/managesite.aspx?manageuser=" + manageuser + "&manageorganization=" + manageorg + "&editsite=" + site + "&keepThis=true&TB_iframe=true&height=170&width=360");
                    }
                }
                );
            });
        </script>

    </div>
</asp:Content>
